//
//  new1.cpp
//  test_cpp
//
//  Created by Camille Xu on 2023/4/18.
//  Copyright © 2023年 Camille Xu. All rights reserved.
// 两个方阵相乘

#include <iostream>
#include <vector>
#include <string>
#include <limits.h>
#include <map>
using namespace std;

vector<vector<float>> getAns(vector<vector<float>> a, vector<vector<float>> b) {
    int n = a.size();
    vector<vector<float>> res(n, vector<float>(n));
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < n; ++j) {
            int sum = 0;
            for (int t = 0; t < n; ++t) {
                sum += a[i][t] * b[t][j];
            }
            res[i][j] = sum;
        }
    }
    return res;
}

int main() {
    vector<vector<float>> a = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}};
    vector<vector<float>> b = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}};
    vector<vector<float>> ans = getAns(a, b);
    for (int i = 0; i < ans.size(); ++i) {
        for (int j = 0; j < ans[i].size(); ++j) {
            cout << ans[i][j] << " ";
        }
        cout << endl;
    }
    return 0;
}
